<template>
  <div class="action-bar">
    <el-dropdown trigger="click">
      <el-button type="primary" size="mini">
        操作<i class="el-icon-arrow-down el-icon--right" />
      </el-button>
      <el-dropdown-menu slot="dropdown">
        <el-dropdown-item>
          <el-button type="text" size="mini" icon="el-icon-edit" @click="$parent.batchRead($parent.selections)">
            批量已读
          </el-button>
        </el-dropdown-item>
        <el-dropdown-item>
          <el-button type="text" size="mini" icon="el-icon-delete" @click="$parent.batchRemove($parent.selections)">
            批量删除
          </el-button>
        </el-dropdown-item>
        <el-dropdown-item>
          <el-button type="text" size="mini" icon="el-icon-edit" @click="$parent.ignore()">
            一键已读
          </el-button>
        </el-dropdown-item>
        <el-dropdown-item>
          <el-button type="text" size="mini" icon="el-icon-delete" @click="$parent.clear()">
            一键删除
          </el-button>
        </el-dropdown-item>
      </el-dropdown-menu>
    </el-dropdown>
  </div>
</template>
<script>
export default {
  name: 'DictionaryActionDescBar',
  components: {
    // FormDialog,
    // EditForm
  },
  data() {
    return {
      dialogFormVisible: false
    }
  },
  methods: {
    // 新建用户按钮点击处理
    add() {
      this.dialogFormVisible = true
    },
    // 创建用户对话框确认事件处理
    ok() {
      // 直接调用表单实例的保存方法
      this.$refs.editForm.save().then(response => {
        if (response === false) return
        this.$message({
          showClose: true,
          message: '操作成功！',
          type: 'success'
        })
        // 调用pageable-table实例的mixin方法refresh()，更新表格
        this.$parent.refresh()
        // 关闭对话框
        this.dialogFormVisible = false
        this.$refs.editForm.reset()
      })
    },
    cancel() {
      this.$refs.editForm.reset()
      this.dialogFormVisible = false
    }
  }

}
</script>
